Part 1: Crash Course
Technical Guide, aka How Do I C64??1. Getting Started
2. Typing in BASIC Programs
3. Typing in Machine Language Programs
4. Basic Keys
5. Basic Commands
6. Errors
7. Advanced Topics
Getting Started
Before we get started with anything else: VICE uses direct 1541-II emulation at native speeds, which means you're going to be waiting a while for disk operations. This is normal. As long as the light in the lower right of the window is red and the numbers are moving, the system hasn't locked up. There's ways around this, but I don't want to get into that here as it's going to be complex enough.
To start with, grab the following:
- VICE Emulator - you want the non-SDL version
- gazette.d64.zip - Unzip this to get gazette.d64, it has MLX and Automatic Proofreader already saved
- An issue of your choice of Compute!'s Gazette
- Read "How to Type In COMPUTE!'S Gazette Programs" in the issue It will familiarize you with C64's "quote mode" and the magazine's general notation. It is absolutely required reading if you've never used a C64 before, or else you are going to get very confused very quickly.
You'll also need this image:
This is the native key mapping for the C64. You can get VICE to use a modern layout so your PC keyboard behaves as expected, but everyone will laugh at you and call you names behind your back.
Locate VICE and execute x64, which is the C64 emulator.
You'll see the above. At this point, you're good to go. There's really only two more things you may want to fiddle with:
- Settings -> Joystick Settings. The Commodore 64 had two joystick ports that responded to programming in completely different ways. You will spend a lot of time trying to figure out which goddamn port the game wants. This menu is where you can swap between the two.
- Settings -> Keyboard Settings. You can select Symbolic US here to go with a more modern PC keyboard layout instead of the direct C64 Positional mapping. (You wuss.)
How to Type Shit In: BASIC Programs
- File -> Attach Disk Image -> Drive 8 -> gazette.d64
- Ctrl-Alt-R (hard resets the machine)
- LOAD "PROOFREADER",8
- RUN
Once it says "PROOFREADER ACTIVE", you're good to go! Just start hammering in the code. Every time you hit Return, a little two-letter checksum will appear in the upper-left corner. Compare it to checksum next to the line in the magazine. If it's different, you screwed up. Cursor up and do it again.
When you're done coding---or if just want to take a break---you can save your file thusly:
SAVE "@O:WHATEVER",8
WHATEVER is obviously the filename.
Once you're done and everything's saved, run it like any other program! On future boots, you can use the LOAD command to get it back into memory.
How to Type Shit In: Machine Language Programs
Oh boy, are you in for a treat!
Programs more complicated than a few beeps and boops require tighter code that fits into the C64's limited memory---and thus, requires machine language. These are the actual raw, native bytes that assemblers spit out after processing source code. The average program length in Compute!'s is about three pages of three columns of this shit. If you're willing to brave the wilds, though, this is where the good stuff is.
- File -> Attach Disk Image -> Drive 8 -> gazette.d64
- Ctrl-Alt-R (hard resets the machine)
- LOAD "MLX",8
- RUN
- Enter Starting and Ending address. (You can find it in the article itself, not the code.)
- N to skip clearing memory
- E to enter data
- Type in the Starting Address from the article
- Get to work typing in pages and pages of hex
MLX has a built-in checksum that will make sure both the data and the address associated with it are correct. If everything works out, it will beep and show the next address. Otherwise, it will make a very rude noise and tell you to redo the line. Once you're finished, you'll automatically be taken back to the main menu:
- Hit S to save
- Type in the program name. (Follow the article's instructions! A lot of times they have to be named very specific things.)
- Hit D for disk
- Wait an excrutiatingly long time
Once the menu comes back, you're done. If you want to save what you have so far and come back later, you're going to have to work around a design flaw in MLX. See "Advanced Topics" for this.
Basic (hurr hurr) Keys
First and foremost, Commodore machines have something called "quote mode." When you hit quote, you enable a mode where special keys, i.e. CLR/HOME, are printed as reversed symbols instead of directly executed. You'll know this has happened when you start getting gibberish instead of your cursor moving around like you expect. To get out of it, either type another quote or just hit Return.
Secondly: The C64 overwrites text instead of inserting. (You can insert extra spaces one at a time if you need to.) It will also happily print status and error messages right over the top of any text in its way, so keep that in mind.
Thirdly: You can re-run commands by cursoring up to them and hitting Return again! This is very helpful for when you fuck something up and the Automatic Proofreader tells you that you're wrong and also dumb.
Finally, here are some common hard-to-find keys and their mappings/meanings to the C64 keyboard:
- Tab - CONTROL
- Ctrl - COMMODORE KEY
- Shift + Home - CLR/HOME, aka clear screen
- Shift + Backspace - INS a space to the right
- ESC - RUN/STOP. Stops a currently executing BASIC program.
- Hold ESC then PgDwn - RUN/STOP RESTORE. Soft-resets the machine from anywhere. Don't trust this, just use Ctrl-Alt-R to do VICE's hard reset. It's there if you want/need it, though.
The rest can be found on the keyboard JPG from "Getting Started."
Basic Commands
This should be enough to get you started:
- LOAD "FILENAME",8 - Load a BASIC program into memory.
- LOAD "FILENAME",8,1 - Load a machine language program into memory. May need a SYS command afterwards to run. The article will tell you if this is the case.
- LIST - Show lines from current program. You can specify a range (i.e. 200-400) if you like. RUN/STOP (ESC) will stop the data dump early.
- RUN - Run a program. Durp.
- NEW - Flush memory and start over. Always use this before starting new programs, etc.
- LOAD "$",8 - Load the directory of the current disk into memory. Once complete, use LIST to view it. (Warning: This will clobber your current program if you have one. Also, use NEW afterwards before starting a program, or you'll have a lot of garbage left in it.)
Errors
You'll know when you get one. "? SYNTAX ERROR" is the most common, it means the computer has no idea what you're even trying to do. "? FILE NOT FOUND" is another common one and speaks for itself.
Also, keep your eye on the red/black light in the lower right corner of VICE's window. If it's blinking, something's gone wrong in the disk---either a bad filename, you tried to overwrite a file without the overwrite option set, etc.
Advanced Topics
MLX doesn't use the overwrite flag when it writes data to a disk. If you want to save and come back later, you'll need to get around this using direct disk drive commands.
- Hit Return on a blank line to get back to the menu. (Note the address you stopped at!)
- If this is the first time you're saving, just save as normal, and you're done.
- For second and subsequent saves, add ".2" to the name when you save
- Ctrl-Alt-R
- OPEN15,8,15,"S0:FILENAME":PRINT#15,"R0:FILENAME=FILENAME.2":CLOSE15
- yes that line is howling insanity but it should work nonetheless
- LOAD "$",8:LIST to make sure it took
In case you need to do some file management for whatever reason:
- Scratch: (aka Delete File) OPEN15,8,15,"S0:WHATEVER":CLOSE15
- Rename: OPEN15,8,15,"R0:NEWNAME=OLDNAME":CLOSE15
Feel free to post any and all questions to this thread!
I've used the C64 way more than is healthy, and I can answer all your questions. Probably. Or maybe not.